net/packet: fix overflow in check for priv area size
authorAndrey Konovalov <andreyknvl@google.com>
Wed, 29 Mar 2017 14:11:20 +0000 (16:11 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 30 Mar 2017 01:16:33 +0000 (01:16 +0000)
commit6535fa560dadd28a467d2292679cbfad5dbfb00b
tree0d4917ee1b3a1079b564cd06a8b6d9a8b24de6c5
parenta2ca8cfb84a1eb436804b93876ce276eebabe870
net/packet: fix overflow in check for priv area size

Subtracting tp_sizeof_priv from tp_block_size and casting to int
to check whether one is less then the other doesn't always work
(both of them are unsigned ints).

Compare them as is instead.

Also cast tp_sizeof_priv to u64 before using BLK_PLUS_PRIV, as
it can overflow inside BLK_PLUS_PRIV otherwise.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name net-packet-fix-overflow-in-check-for-priv-area-size.patch
net/packet/af_packet.c